package com.zdb.n1.repository;

import com.zdb.n1.entity.FitnessGoal;
import com.zdb.n1.entity.User;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

import java.time.LocalDateTime;
import java.util.List;

@Repository
public interface FitnessGoalRepository extends JpaRepository<FitnessGoal, Long> {

    List<FitnessGoal> findByUserOrderByStartDateDesc(User user);

    Page<FitnessGoal> findByUserOrderByStartDateDesc(User user, Pageable pageable);

    List<FitnessGoal> findByUserAndStatusOrderByStartDateDesc(User user, FitnessGoal.GoalStatus status);

    List<FitnessGoal> findByUserAndTypeOrderByStartDateDesc(User user, FitnessGoal.GoalType type);

    List<FitnessGoal> findByUserAndTargetDateBeforeAndStatusOrderByStartDateDesc(
            User user, LocalDateTime date, FitnessGoal.GoalStatus status);

    List<FitnessGoal> findByUserAndTargetDateAfterAndStatusOrderByTargetDateAsc(
            User user, LocalDateTime date, FitnessGoal.GoalStatus status);
} 